<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
<h:head>
    <link href="../../css/component.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .confirm {
            top: 10% !important;
            left: 50% !important;
        }
    </style>
</h:head>

<h:body>
    <ui:param name="bean" value="#{sysUserManagerAction}" />

    <span class="pagetitle">用户管理</span>
    <p:separator />

    <h:form id="fsearch">
        <p:panel id="panel" header="查询" style="margin-bottom:10px;">
            <p:dataTable id="dlist0" var="user" value="#{bean.user}" resizableColumns="true" paginator="false" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                <p:column headerText="用户名" style="text-align:center" width="20%">
                    <p:inputText size="16" maxlength="64"  value="#{user.username}" styleClass="inputText" />
                </p:column>
                <p:column headerText="部门" style="text-align:center" width="25%">
                    <p:inputText size="16" maxlength="64"   value="#{user.department}" styleClass="inputText" />
                </p:column>
                <p:column headerText="描述" style="text-align:center" width="40%">
                    <p:inputText size="16" maxlength="64"  value="#{user.description}" styleClass="inputText" />
                </p:column>
                <p:column headerText="操作" style="text-align:center" width="15%">
                    <p:commandButton value="查询" action="#{bean.search}" update=":dform" ajax="true"></p:commandButton>
                </p:column>
            </p:dataTable>
        </p:panel>
    </h:form>
    <br />

    <h:form id="dform">
        <p:growl id="growl" showDetail="true" sticky="true" />

        <div class="data" id="data">
            <p:panel id="panel1" header="结果" style="margin-bottom:10px;">
                <p:dataTable id="dlist" rowIndexVar="index" var="user" value="#{bean.userList}" resizableColumns="true" paginator="true" paginatorPosition="top" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
                    <p:column headerText="标识" style="text-align:center" width="5%">
                        <h:outputText value="#{user.id}" styleClass="inputText" readonly="true"/>
                    </p:column>
                    <p:column headerText="登录名" style="text-align:center" width="15%">
                        <h:outputText value="#{user.username}" styleClass="inputText" readonly="true"/>
                    </p:column>
                    <p:column headerText="部门" style="text-align:center" width="25%">
                        <p:inputText size="12" maxlength="64" styleClass="inputText"  value="#{user.department}"/>
                    </p:column>
                    <p:column headerText="描述" style="text-align:center" width="40%">
                        <p:inputText size="24" maxlength="64"  styleClass="inputText" value="#{user.description}"/>
                    </p:column>
                    <p:column headerText="操作" style="text-align:center" width="15%">
                        <p:commandButton value="修改" action="#{bean.modify(user)}"		update="dlist :#{p:component('growl')}" ajax="true"/>
                        <p:commandButton value="重置" action="#{bean.reset(user.id)}"		update="dlist :#{p:component('growl')}" ajax="true"/>
                        <p:commandButton value="删除" action="#{bean.delete(user.id)}"	update="dlist :#{p:component('growl')}" ajax="true">
                            <p:confirm header="确认框" message="是否确定删除用户" icon="ui-icon-alert" />
                        </p:commandButton>
                    </p:column>
                </p:dataTable>
            </p:panel>
        </div>

        <p:confirmDialog global="true"  styleClass="confirm" showEffect="fade" hideEffect="fade">
            <p:commandButton value="确定" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
            <p:commandButton value="取消" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
        </p:confirmDialog>
    </h:form>
</h:body>
</html>
